#ifndef __DEFINITIONS__
#define __DEFINITIONS__

// Includes required in all the files
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <errno.h>
#include <unistd.h>
#include <pthread.h>
#include <fcntl.h>
#include "openssl/ssl.h"
#include "openssl/err.h"
#include "openssl/crypto.h"

// Definitions
#define MAXIPLENGTH  16
#define CONFIGFILE   "asproxy.config"
#define HOSTNAMESIZE 512
#define SOURCEDETAILSIZE 100
#define SSLFILESIZE 256
#define HANDLERSIZE 256

// Defaults
#define ANY_DEFAULT "ANY"
#define NONE_DEFAULT "NONE"
#define WORKER_DEFAULT 20
#define CONN_DEFAULT 5
#define DEBUG_DEFAULT 'N'
#define BUFFERSIZE_DEFAULT 1024
#define SOCKTIMEOUT_DEFAULT 10

// Proxy Data to pass to the Daemon to Start
typedef struct 
{
	char ListeningIP[MAXIPLENGTH];
	int  ListeningPort;
	char DestinationIP[MAXIPLENGTH];
	char FailoverIP[MAXIPLENGTH]; // Destination Failover IP
	int  DestinationPort;
	int  BufferSize;
	int  SocketTimeout; // Socket Timeout
	char SourceDetailFormat[SOURCEDETAILSIZE];
	int  ConnectionBacklog;
	int  WorkerThreadCount;
	char SSLCertFile[SSLFILESIZE];
	char SSLCAPath[SSLFILESIZE];
	char CustomHandler[HANDLERSIZE];
	char Debug;
} PROXYCONFIG;

// The global Proxy Config that all processes will use
PROXYCONFIG     g_proxyconfig;

typedef struct {
  int   value;
  char  string[128];
} thread_parm_t;

// Connection Settings for Client and Server threads
typedef struct
{
	int ClientFD;
	int ServerFD;
	SSL* SSL;
} CONNSETTING;

#endif // __DEFINITIONS__